package com.shop2cn.iapi.sqrefund.testcase;

import java.util.Arrays;

import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.experimental.categories.Category;

import com.shop2cn.iapi.sqrefund.parameter.SaveOrUpdateRefundGoodsExpressInfoListReq;
import com.shop2cn.iapi.sqrefund.parameter.bean.RefundGoodsExpressInfoVo;
import com.shop2cn.iapi.sqrefund.service.SaveOrUpdateRefundGoodsExpressInfoListCall;
import com.ymt.core.tool.Logger;
import com.ymt.utils.annotation.TestCase;
import com.ymt.utils.annotation.TestSuite;
import com.ymt.utils.tag.P3;

/**
 * 发货 FreeMaker Template自动生成代码
 */
@TestSuite
public class Ts_SaveOrUpdateRefundGoodsExpressInfoList {

	private static SaveOrUpdateRefundGoodsExpressInfoListReq saveOrUpdateRefundGoodsExpressInfoListReq;
	private static SaveOrUpdateRefundGoodsExpressInfoListCall saveOrUpdateRefundGoodsExpressInfoListCall;

	@BeforeClass
	public static void setUp() {
		Logger.createResultFile("保存或更新运单信息");
	}

	@Before
	public void caseUp() {

		saveOrUpdateRefundGoodsExpressInfoListReq = new SaveOrUpdateRefundGoodsExpressInfoListReq();
		saveOrUpdateRefundGoodsExpressInfoListCall = new SaveOrUpdateRefundGoodsExpressInfoListCall();
	}

	@AfterClass
	public static void tearDown() {
		Logger.generateResult(saveOrUpdateRefundGoodsExpressInfoListCall.getOpurl());
	}

	@After
	public void caseDown() {
		Logger.end();
	}
	
	@Test
	@Category(P3.class)
	@TestCase
	public void Tc_SaveOrUpdateRefundGoodsExpressInfoList_001() {
		Logger.start(false, "保存运单信息成功");
		try {
			
			RefundGoodsExpressInfoVo refundGoodsExpressInfoVo = new RefundGoodsExpressInfoVo();
			
			refundGoodsExpressInfoVo.setExpressBillNo("expressBillNo");
			refundGoodsExpressInfoVo.setExpressCode("expressCode");
			refundGoodsExpressInfoVo.setExpressCompany("expressCompany");

			saveOrUpdateRefundGoodsExpressInfoListReq.setExpressList(Arrays.asList(refundGoodsExpressInfoVo));
			saveOrUpdateRefundGoodsExpressInfoListReq.setMerchantId(23592735L);
			saveOrUpdateRefundGoodsExpressInfoListReq.setRefundNo("TH210527000156802");
			saveOrUpdateRefundGoodsExpressInfoListReq.setUserId(375923L);
			saveOrUpdateRefundGoodsExpressInfoListReq.setUsername("username");

			saveOrUpdateRefundGoodsExpressInfoListCall.setData(saveOrUpdateRefundGoodsExpressInfoListReq);
			saveOrUpdateRefundGoodsExpressInfoListCall.callService();
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category(P3.class)
	@TestCase
	public void Tc_SaveOrUpdateRefundGoodsExpressInfoList_002() {
		Logger.start(false, "输入一个错误的退单号，保存运单信息失败");
		try {
			
			RefundGoodsExpressInfoVo refundGoodsExpressInfoVo = new RefundGoodsExpressInfoVo();
			
			refundGoodsExpressInfoVo.setExpressBillNo("expressBillNo");
			refundGoodsExpressInfoVo.setExpressCode("expressCode");
			refundGoodsExpressInfoVo.setExpressCompany("expressCompany");

			saveOrUpdateRefundGoodsExpressInfoListReq.setExpressList(Arrays.asList(refundGoodsExpressInfoVo));
			saveOrUpdateRefundGoodsExpressInfoListReq.setMerchantId(23592735L);
			saveOrUpdateRefundGoodsExpressInfoListReq.setRefundNo("TH5982358923985");
			saveOrUpdateRefundGoodsExpressInfoListReq.setUserId(375923L);
			saveOrUpdateRefundGoodsExpressInfoListReq.setUsername("username");

			saveOrUpdateRefundGoodsExpressInfoListCall.setData(saveOrUpdateRefundGoodsExpressInfoListReq);
			saveOrUpdateRefundGoodsExpressInfoListCall.callService();
			
			Logger.verifyEquals("当前没有待商品退回的订单",
					saveOrUpdateRefundGoodsExpressInfoListCall.getMsg(),
					"验证resultMessage");
			Logger.verifyEquals(3,
					saveOrUpdateRefundGoodsExpressInfoListCall.getCode(),
					"验证resultCode");
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
}
